import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    config: {}, // 配置信息
    user: {}, // 用户信息
    userAddress: '', // 用户钱包地址
    contractAddress: process.env.VUE_APP_CONTRACT_ADDRESS, // 合约地址
    usdtAddress: process.env.VUE_APP_USDT_ADDRESS, // USDT合约地址
    tokenAddress: process.env.VUE_APP_TOKEN_ADDRESS, // 代币合约地址（目前没用上）
    isFinish: false, // 活动是否已结束
    isRegister: false, // 用户是否已注册
  },

  mutations: {
    setConfigInfo(state, data) {
      state.config = data
    },

    setUserInfo(state, data) {
      state.user = data
    },

    setUserAddress(state, data) {
      state.userAddress = data
    },

    setIsFinish(state, data) {
      state.isFinish = data
    },

    setIsRegister(state, data) {
      state.isRegister = data
    },
  },
})
